﻿
@{
    ViewBag.Title = "申请提现";
    Layout = "~/Views/Shared/DetailsInfoLayout.cshtml";
}

@section CSS{
    <style>
        .content .row { font-family: '微软雅黑','Microsoft YaHei'; }
    </style>
}
<section class="content">
    <div class="row">
        <div class="col-md-9">
            <div class="ibox-content">
                <form class="form-horizontal" id="form-add">
                    <input type="hidden" id="id" name="id" value="0" />
                    <div class="form-group">
                        <label class="col-sm-2 control-label">收款账号：</label>@ViewBag.BankCard
                    </div>
                    <div class="form-group">
                        @*<label class="col-sm-2 control-label">提现金额(费率 @ViewBag.Rate %) </label>*@
                        <span style="float:right;margin-right:20px;" class="control-label">可提现金额￥ <b>@ViewBag.Balance.ToString("f2")</b> 元</span>
                        <div class="col-sm-5">
                            <input type="number" name="money" id="money" max="50000" step="100" required="" value="" number="true" aria-required="true" class="form-control" placeholder="请输入提现金额" />
                        </div>
                        <div class="col-sm-5">
                           单笔至少提现100元，最多提现5万元，提现金额必须是100的倍数
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">支付密码</label>
                        <div class="col-sm-5">
                            <input type="password" name="password" id="password" class="form-control" placeholder="请输入支付密码" required="" aria-required="true" />
                            <span class="help-block m-b-none"></span>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <div class="col-sm-4 col-sm-offset-3">
                            <button class="btn btn-primary" type="submit">立即申请</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
@section JS{
    <script src="~/Content/js/jquery.form.js"></script>
    <script src="~/Content/plugins/validate/jquery.validate.min.js"></script>
    <script src="~/Content/plugins/validate/messages_zh.min.js"></script>
    <script type="text/javascript">
        $(function () {

        })
        $("#form-add").validate({
            ajaxPost: true,
            submitHandler: function (form) {
                infosubmit();
            }
        });

        var flag = true;
        function infosubmit() {
            if (flag) {
                $("#form-add").ajaxSubmit({
                    url: "/Finance/ApplyWithdraw", type: "POST",
                    dataType: "json",
                    success: function (result) {
                        if (result.status == "y") {
                            parent.layer.msg("申请成功", { time: 1200 }, function () {
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.location.replace(parent.location.href);
                                parent.layer.close(index);
                            });
                        }
                        else {
                            parent.layer.msg(result.info, { time: 2000 });
                            flag = true;
                        }
                    }
                });
            }
        }

    </script>
}

